package tr.com.oyunus.server.command.transform.impl;

import org.codehaus.jackson.map.ObjectMapper;
import org.springframework.stereotype.Component;
import tr.com.oyunus.server.command.Command;
import tr.com.oyunus.server.command.transform.CommandDeserializer;

import java.io.IOException;


@Component(value="defaultDeserializer")
public class StringJsonCommandDeserializer implements CommandDeserializer<String> {
    private static final ObjectMapper mapper = new ObjectMapper();

    @Override
    public Command deserialize(String commandSource) throws IOException {
       return  mapper.readValue(commandSource, Command.class);

    }
}
